package controle.mascara;

import java.text.ParseException;

import javax.swing.text.MaskFormatter;

public class Mascara {
	
	
	
	//modo de usar JFormattedTextField texto = new JFormattedTextField( Mascara.cnpjMask() ); 
	 private static MaskFormatter CNPJ_MASK;  
	 private static MaskFormatter CPF_MASK;
	 private static MaskFormatter CEP_MASK;
	 private static MaskFormatter OBJ_SOCIAL_MASK;
	  
	    public static MaskFormatter cnpjMask() throws ParseException {  
	        if( CNPJ_MASK == null ) { // inicializa  
	        	CNPJ_MASK = new MaskFormatter( "##.###.###/####-##" );  
	        	  
	        }  
	  
	        return CNPJ_MASK;  
	    }  
	    
	    public static MaskFormatter cpfMask() throws ParseException {  
	        if( CPF_MASK == null ) { // inicializa  
	        	CPF_MASK = new MaskFormatter( "###.###.###-##" );  
	        	  
	        }  
	  
	        return CPF_MASK;  
	    }  
	    
	    public static MaskFormatter cepMask() throws ParseException {  
	        if( CEP_MASK == null ) { // inicializa  
	        	CEP_MASK = new MaskFormatter("##.###-###");  
	        }
	        return CEP_MASK; 
	        }  
	        public static MaskFormatter objSocialMask() throws ParseException {  
		        if( OBJ_SOCIAL_MASK == null ) { // inicializa  
		        	OBJ_SOCIAL_MASK = new MaskFormatter( "####-#/##" );  
		        	  
		        }  
	  
	        return OBJ_SOCIAL_MASK;  
	    }  

}
